#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
const int N=500003;
const int PIN=1061109567;
struct Range{
	int l,r,s,t;
	Range(){ l=0,r=0,s=0,t=0; }
	Range(int _l,int _r,int _s=0,int _t=0){
		l=_l,r=_r,s=_s,t=_t;
	}
}a[N],b[N];
struct cmpl_Range{
	bool operator()(const Range& x,const Range& y){
		return (x.l!=y.l)?(x.l<y.l):(x.r>y.r);
	}
};
struct cmpr_Range{
	bool operator()(const Range& x,const Range& y){
		return (x.r!=y.r)?(x.r<y.r):(x.l>y.l);
	}
};
int n,q,res[N];
set<Range,cmpl_Range> st;
multiset<Range,cmpl_Range> hpl;
multiset<Range,cmpr_Range> hpr;
namespace SGT{
	struct Node{
		int l,r,chk,hadd,hchk;
	}node[(1<<20)+3];
	void update_hadd(int u,int x){
		node[u].hadd=min(node[u].hadd,x);
		node[u].hchk=min(node[u].hchk,node[u].chk+x);
	}
	void update_hchk(int u,int x){
		node[u].hchk=min(node[u].hchk,x);
	}
	void update_chk(int u,int x){
		node[u].chk=min(node[u].chk,x);
	}
	void push_down(int u){
		if(node[u].hadd<PIN/2){
			update_hadd(u*2  ,node[u].hadd);
			update_hadd(u*2+1,node[u].hadd);
			node[u].hadd=PIN;
		}
		if(node[u].hchk<PIN/2){
			update_hchk(u*2  ,node[u].hchk);
			update_hchk(u*2+1,node[u].hchk);
			node[u].hchk=PIN;
		}
		if(node[u].chk<PIN/2){
			update_chk(u*2  ,node[u].chk);
			update_chk(u*2+1,node[u].chk);
			node[u].chk=PIN;
		}
	}
	void build(int u,int l,int r){
		node[u]={l,r,PIN,PIN,PIN};
		if(l<r){
			int mid=(l+r)/2;
			build(u*2  ,l,mid  );
			build(u*2+1,mid+1,r);
		}
	}
	void modify_min(int u,int l,int r,int x){
		if(l>r) return ;
		if(node[u].l>=l&&node[u].r<=r) update_chk(u,x);
		else{
			push_down(u);
			int mid=(node[u].l+node[u].r)/2;
			if(l<=mid) modify_min(u*2  ,l,r,x);
			if(r> mid) modify_min(u*2+1,l,r,x);
		}
	}
	void modify_his(int u,int l,int r,int x){
		if(l>r) return ;
		if(node[u].l>=l&&node[u].r<=r) update_hadd(u,x);
		else{
			push_down(u);
			int mid=(node[u].l+node[u].r)/2;
			if(l<=mid) modify_his(u*2  ,l,r,x);
			if(r> mid) modify_his(u*2+1,l,r,x);
		}
	}
	void query(int u,int res[N]){
		if(node[u].l==node[u].r)
			res[node[u].l]=min(res[node[u].r],node[u].hchk);
		else
			push_down(u),query(u*2,res),query(u*2+1,res);
	}
}
int read(){
	char ch; int x=0;
	do ch=getchar();
	while(ch<'0'||ch>'9');
	while(ch>='0'&&ch<='9')
		x=x*10+(ch-'0'),ch=getchar();
	return x;
}
char readChar(){
	char ch; do ch=getchar();
	while(ch!='A'&&ch!='R');
	return ch;
}
void write(int x){
	char a[12]; int n=0,i;
	do a[++n]=x%10+'0',x/=10; while(x>0);
	for(i=n;i>0;i--) putchar(a[i]);
	putchar('\n');
}
int main(){
	freopen("stone.in","r",stdin);
	freopen("stone.out","w",stdout);
	set<Range>::iterator s1;
	int i,j,l,r; char opt;
	for(q=read(),i=1;i<=q;i++){
		opt=readChar(),l=read(),r=read();
		if(opt=='A'){
			st.insert(Range(l,r,i));
			hpl.insert(Range(l,r));
			hpr.insert(Range(l,r));
		}else{
			s1=st.lower_bound(Range(l,r));
			n++,a[n]=*s1,a[n].t=i-1,st.erase(s1);
			hpl.erase(hpl.find(Range(l,r)));
			hpr.erase(hpr.find(Range(l,r)));
		}
		res[i]=((*hpl.rbegin()).r)-((*hpr.begin()).l);
	}
	for(s1=st.begin();s1!=st.end();++s1)
		n++,a[n]=*s1,a[n].t=q;
	st.clear(),hpl.clear(),hpr.clear();
	for(i=1;i<=n;i++) b[i]=a[i];
	sort(a+1,a+n+1,cmpr_Range());
	sort(b+1,b+n+1,cmpl_Range());
	SGT::build(1,1,q);
	for(i=j=n;i>0;i--){
		while(j>0&&b[j].l>=a[i].r)
			SGT::modify_min(1,b[j].s,b[j].t,b[j].r),j--;
		SGT::modify_his(1,a[i].s,a[i].t,-a[i].l);
	}
	SGT::query(1,res);
	for(i=1;i<=q;i++) write(res[i]);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
